/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.foxinline.manager.criar;

import br.com.foxinline.modelo.Sala;
import br.com.foxinline.servico.SalaServico;
import br.com.foxinline.utilitario.Msg;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

/**
 *
 * @author ely
 */
@ViewScoped
@ManagedBean
public class ManagerCriarSala {

    @EJB
    public SalaServico salaServico;
    public Sala sala;

    @PostConstruct
    public void init() {
        sala = new Sala();
    }

    public void salvar() {
        try {


            if (sala.getNumero() != null) {
                salaServico.salvar(sala);
                sala = new Sala();
                Msg.messagemInfo(Msg.SuccessFull);
            } else {
                Msg.messagemError("O campo Número é obrigatório");
            }
        } catch (Exception error) {
        }
    }

    public Sala getSala() {
        return sala;
    }

    public void setSala(Sala sala) {
        this.sala = sala;
    }
}
